package com.yupi.yuojbackendjudgeservice.judege.codesandbox;


import com.yupi.yuojbackendjudgeservice.judege.codesandbox.impl.ExampleCodeSandboxImpl;
import com.yupi.yuojbackendjudgeservice.judege.codesandbox.impl.RemoteCodeSandboxImpl;
import com.yupi.yuojbackendjudgeservice.judege.codesandbox.impl.ThirdPartyCodeSandboxImpl;

/**
 * @Description 根据字符串参数创建 代码沙箱示例
 * @Author JFeng
 * @Date 2023/10/14
 */

public class CodeSandboxFactory {
    /**
     * 创建代码沙箱示例
     *
     * @param type 沙箱类型
     * @return
     */
    public static CodeSandbox newInstance(String type) {
        switch (type) {
            case "example":
                return new ExampleCodeSandboxImpl();
            case "remote":
                return new RemoteCodeSandboxImpl();
            case "thirdParty":
                return new ThirdPartyCodeSandboxImpl();
            default:
                return new ExampleCodeSandboxImpl();
        }
    }
}
